package org.weed.gadgets.audio.asf;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.math.BigInteger;
import java.util.Arrays;

import org.weed.gadgets.util.ByteUtils;

public class ASF {
	public static final int GUID_LENGTH = 16;
	public static final int OBJ_SIZE_LENGTH = 8;
	
	
	public void initHeaderObject() {
		
	}
	
	public static void main(String[] args) throws Exception {
		String path = "C:\\Users\\ctang\\Desktop\\test.wma";
		File file = new File(path);
		
		
		RandomAccessFile rafile = new RandomAccessFile(file, "r");
		
		System.out.println(file.exists());
		InputStream in = new FileInputStream(file);
		
		byte[] guid = new byte[GUID_LENGTH];
		in.read(guid, 0, GUID_LENGTH);
		ByteUtils.reverse(guid);
		ByteUtils.printBytes(guid);
		System.out.println(Arrays.toString(guid));
		byte[] size = new byte[OBJ_SIZE_LENGTH];
		in.read(size, 0, OBJ_SIZE_LENGTH);
		ByteUtils.printBytes(size);
		ByteUtils.reverse(size);
		ByteUtils.printBytes(size);
		BigInteger obj_size = new BigInteger(1, size);
		System.out.println(obj_size);
	}
}
